<template>
	<view>
		<view class="main">
			<text>下载地址</text>
			<text style="padding: 0 20rpx; box-sizing: border-box; display: block; word-break: break-all; line-height: 2; border: 1rpx solid #aaaaaa; border-radius: 10rpx; height: auto;">{{loadUrl}}</text>
			<view class="footer flex">
				<view class="buttoncss" @tap="copyUrl">复制链接</view>
			</view>
		</view>
		<!-- <view class="title">为了保证数据安全,下载地址有效期为12小时,请及时下载</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				loadUrl: '',
			}
		},
		methods: {
			copyUrl() {
				uni.setClipboardData({
					data: this.loadUrl,
					success: (res) => {
						uni.showToast({
							icon: 'none',
							title: '复制成功，请粘贴到浏览器下载',
							duration: 2000
						})
					}
				})
			}
		},
		onLoad(options) {
			options.loadUrl ? this.loadUrl = options.loadUrl : this.loadUrl = ''
			options.currentTab ? this.currentTab = options.currentTab : this.currentTab = ''
			if(this.currentTab == 0) {
				uni.setNavigationBarTitle({
					title: '下载统计结果'
				})
			} else  {
				uni.setNavigationBarTitle({
					title: '下载详细数据'
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #F0F0F0;
		font-weight: 500;
	}

	.main {
		width: 690rpx;
		height: 400rpx;
		background: #fff;
		margin: 20rpx auto;
		box-shadow: 0rpx 5rpx 20rpx 0rpx rgba(240, 240, 240, 1);
		border-radius: 10rpx;
		font-size: 30rpx;
		padding: 0 20rpx;
		box-sizing: border-box;

		text {
			display: block;
			height: 100rpx;
			line-height: 100rpx;
		}

		input {
			width: 96%;
			margin: 20rpx auto;
			border-radius: 20rpx;
			height: 60rpx;
			line-height: 60rpx;
			border: 1rpx solid #DFDFDF;
		}

		.footer {
			margin-top: 50rpx;

			.buttoncss {
				width: 150rpx;
				height: 70rpx;
				line-height: 70rpx;
				border-radius: 50rpx;
				background: #00A0E9;
				text-align: center;
				color: #fff;
				font-size: 30rpx;
				margin-right: 20rpx;
				padding: 0 30rpx;
			}
		}
	}

	.title {
		color: #999;
		font-size: 24rpx;
		margin: 20rpx auto;
		width: 690rpx;
	}
</style>
